import { _decorator, Component } from 'cc';
const { ccclass, property } = _decorator;
import * as fgui from "fairygui-cc";
import CountdownTimer from '../utils/CountdownTimer';
import { GameController } from '../manager/GameController';

export default class ToastCtrl {
    private _node: fgui.GComponent;
    private _controller: fgui.Controller;

    private _roundLabel: fgui.GComponent;
    private _playerNumLabel: fgui.GComponent;

    constructor(node: fgui.GComponent) {
        this._node = node;
        this._controller = this._node.getController('round');
        this._playerNumLabel = this._node.getChild('n3').asCom
        this._roundLabel = this._node.getChild('n7').asCom
    }

    public gameStart(){
        this._controller.setSelectedIndex(1)
    }

    public gameEnd(){
         this._controller.setSelectedIndex(2)
    }

    public gameRoundChange(){
         this._roundLabel.text = `${6 - GameController.Instance.gameRound}`
    }

    public updateGamePlayerNums(nums){
        this._playerNumLabel.text = nums;
    }

    public reset(){
        this._controller.setSelectedIndex(0)
        this._playerNumLabel.text = '1/10'
    }
}